import {
  createRouter,
  createWebHistory
} from 'vue-router';

const router = createRouter({
  routes: [{
      // 登录
      path: '/login',
      component: () => import('@/views/login/index.vue'),
      name: 'Login'
    },
    {
      // 空/的重定向以及子路由
      path: '/',
      component: () => import("@/layout/index.vue"),
      name: '/',
      // 重定向
      redirect: '/users',
      // 子路由
      children: [{
          // 用户列表
          path: 'users',
          name: 'users',
          component: () => import('@/views/users/index.vue')
        },
        {
          // 角色列表
          path: 'roles',
          name: 'roles',
          component: () => import('@/views/roles/index.vue')
        },
        {
          // 权限列表
          path: 'rights',
          name: 'rights',
          component: () => import('@/views/rights/index.vue')
        },
        {
          // 商品列表
          path: 'goods',
          name: 'goods',
          component: () => import('@/views/goods/index.vue')
        },
        {
          // 商品分类参数
          path: 'params',
          name: 'params',
          component: () => import('@/views/params/index.vue')
        },
        {
          // 商品类别
          path: 'categories',
          name: 'categories',
          component: () => import('@/views/categories/index.vue')
        },
        {
          // 订单列表
          path: 'orders',
          name: 'orders',
          component: () => import('@/views/orders/index.vue')
        },
        {
          path: 'reports',
          name: 'reports',
          component: () => import('@/views/reports/index.vue')
        }, 
      ]
    },
  ],
  history: createWebHistory()
})
export default router;